package com.yygh.oss.controller;

import com.yygh.common.result.Result;
import com.yygh.oss.service.FileService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api/oss/file")
public class FileApiController {

    @Autowired
    private FileService fileService;


    @ApiOperation("/")
    @PostMapping("/fileUpload")
    public Result fileUpload(@RequestPart MultipartFile file) {
        String imagesUrl = fileService.upload(file);
        return Result.ok(imagesUrl);
    }

}
